﻿using System;
using System.Threading.Tasks;
using System.Web.Http;
using CarterWechatServer.WebApi.App_Start;
using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(CarterWechatServer.WebApi.Startup))]

namespace CarterWechatServer.WebApi
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            HttpConfiguration configuration = new HttpConfiguration();

            //注册路由
            WebApiConfig.Register(configuration);

            //注册过滤器
            FilterConfig.Register(configuration);

            //注册Json格式化
            JsonFormatConfig.Register(configuration);

            SwaggerConfig.Register(configuration);

            //注册授权
            OAuth2Config.Register(app);

            WechatConfig.Register();

            //在Owin主机中注册WebApi
            app.UseWebApi(configuration);

        }
    }
}
